import { SETUSERINFO } from './action-types'
let userStr = localStorage.getItem("xf_user_info")
let userObj = userStr ? JSON.parse(userStr) : {}
export function UserReducer(state, action) {
  state = state || {
    userName: "张三",
    role: 'super',
    isLogin: false,
    ...userObj
  }
  switch (action.type) {
    case SETUSERINFO:
      return {
        ...state,
        ...action.info
      }

    default:
      return {
        ...state
      }
  }
}